# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorIssue do
  @moduledoc """
  A group of related ErrorReports received for an app. Similar error reports are grouped together into issues with a likely identical root cause. **Please note:** this resource is currently in Alpha. There could be changes to the issue grouping that would result in similar but more recent error reports being assigned to different issues. This could also cause some issues disappearing entirely and being replaced by new ones. **Required permissions**: to access this resource, the calling user needs the _View app information (read-only)_ permission for the app.

  ## Attributes

  *   `annotations` (*type:* `list(GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1IssueAnnotation.t)`, *default:* `nil`) - List of annotations for an issue. Annotations provide additional information that may help in diagnosing and fixing the issue.
  *   `cause` (*type:* `String.t`, *default:* `nil`) - Cause of the issue. Depending on the type this can be either: * APPLICATION_NOT_RESPONDING: the type of ANR that occurred, e.g., 'Input dispatching timed out'. * CRASH: for Java unhandled exception errors, the type of the innermost exception that was thrown, e.g., IllegalArgumentException. For signals in native code, the signal that was raised, e.g. SIGSEGV.
  *   `distinctUsers` (*type:* `String.t`, *default:* `nil`) - An estimate of the number of unique users who have experienced this issue (only considering occurrences matching the filters and within the requested time period).
  *   `distinctUsersPercent` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GoogleTypeDecimal.t`, *default:* `nil`) - An estimated percentage of users affected by any issue that are affected by this issue (only considering occurrences matching the filters and within the requested time period).
  *   `errorReportCount` (*type:* `String.t`, *default:* `nil`) - The total number of error reports in this issue (only considering occurrences matching the filters and within the requested time period).
  *   `firstAppVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t`, *default:* `nil`) - The earliest (inclusive) app version appearing in this ErrorIssue in the requested time period (only considering occurrences matching the filters).
  *   `firstOsVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t`, *default:* `nil`) - The smallest OS version in which this error cluster has occurred in the requested time period (only considering occurrences matching the filters and within the requested time period).
  *   `issueUri` (*type:* `String.t`, *default:* `nil`) - Link to the issue in Android vitals in the Play Console.
  *   `lastAppVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t`, *default:* `nil`) - The latest (inclusive) app version appearing in this ErrorIssue in the requested time period (only considering occurrences matching the filters).
  *   `lastErrorReportTime` (*type:* `DateTime.t`, *default:* `nil`) - Start of the hour during which the last error report in this issue occurred.
  *   `lastOsVersion` (*type:* `GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t`, *default:* `nil`) - The latest OS version in which this error cluster has occurred in the requested time period (only considering occurrences matching the filters and within the requested time period).
  *   `location` (*type:* `String.t`, *default:* `nil`) - Location where the issue happened. Depending on the type this can be either: * APPLICATION_NOT_RESPONDING: the name of the activity or service that stopped responding. * CRASH: the likely method name that caused the error.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. The resource name of the issue. Format: apps/{app}/{issue}
  *   `sampleErrorReports` (*type:* `list(String.t)`, *default:* `nil`) - Output only. Sample error reports which belong to this ErrorIssue. *Note:* currently a maximum of 1 per ErrorIssue is supported. Format: "apps/{app}/{report}"
  *   `type` (*type:* `String.t`, *default:* `nil`) - Type of the errors grouped in this issue.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations =>
            list(
              GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1IssueAnnotation.t()
            )
            | nil,
          :cause => String.t() | nil,
          :distinctUsers => String.t() | nil,
          :distinctUsersPercent =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GoogleTypeDecimal.t() | nil,
          :errorReportCount => String.t() | nil,
          :firstAppVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t()
            | nil,
          :firstOsVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t()
            | nil,
          :issueUri => String.t() | nil,
          :lastAppVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion.t()
            | nil,
          :lastErrorReportTime => DateTime.t() | nil,
          :lastOsVersion =>
            GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion.t()
            | nil,
          :location => String.t() | nil,
          :name => String.t() | nil,
          :sampleErrorReports => list(String.t()) | nil,
          :type => String.t() | nil
        }

  field(:annotations,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1IssueAnnotation,
    type: :list
  )

  field(:cause)
  field(:distinctUsers)

  field(:distinctUsersPercent,
    as: GoogleApi.PlayDeveloperReporting.V1beta1.Model.GoogleTypeDecimal
  )

  field(:errorReportCount)

  field(:firstAppVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion
  )

  field(:firstOsVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion
  )

  field(:issueUri)

  field(:lastAppVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1AppVersion
  )

  field(:lastErrorReportTime, as: DateTime)

  field(:lastOsVersion,
    as:
      GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1OsVersion
  )

  field(:location)
  field(:name)
  field(:sampleErrorReports, type: :list)
  field(:type)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorIssue do
  def decode(value, options) do
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorIssue.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.PlayDeveloperReporting.V1beta1.Model.GooglePlayDeveloperReportingV1beta1ErrorIssue do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
